<template>
    <div class="login">
        <h2>登录</h2>
        <li><input v-model="username" type="text" placeholder="用户名" /></li>
        <li><input v-model="password" type="password" placeholder="密码" /></li>
        <li style="margin-top: 10%;"><button @click="login">登录</button></li>
        
    </div>

</template>


<script>
    export default {
        name: 'LoginView',
        data() {
            return {
                username: '',
                password: ''
            }
        },
        methods: {
            login() {
                if (this.username && this.password) {
                    this.$router.push('/')
                }else{
                    alert('请输入用户名和密码')
                }
            }
        }
    }
</script>


<style scoped>
    .login {
        max-width: 300px;
        margin:50px auto
    }
</style>
